/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.pacis.shca.domain.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author solriver
 */
@Entity
@Table(name = "tipo_socioeconomico", catalog = "bdshca")
@NamedQueries({
    @NamedQuery(name = "TipoSocioeconomico.findAll", query = "SELECT t FROM TipoSocioeconomico t"),
    @NamedQuery(name = "TipoSocioeconomico.findByIdTipoSocioeconomico", query = "SELECT t FROM TipoSocioeconomico t WHERE t.idTipoSocioeconomico = :idTipoSocioeconomico"),
    @NamedQuery(name = "TipoSocioeconomico.findByTsoNombre", query = "SELECT t FROM TipoSocioeconomico t WHERE t.tsoNombre = :tsoNombre")})
public class SocioEconomicType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_tipo_socioeconomico")
    private Integer id;
    @Column(name = "tso_nombre")
    private String name;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "socioEconomicType")
    private List<SocioEconomicName> socioEconomicNames;

    public SocioEconomicType() {
    }

    public SocioEconomicType(Integer idTipoSocioeconomico) {
        this.id = idTipoSocioeconomico;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<SocioEconomicName> getSocioEconomicNames() {
        return socioEconomicNames;
    }

    public void setSocioEconomicNames(List<SocioEconomicName> socioEconomicNames) {
        this.socioEconomicNames = socioEconomicNames;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SocioEconomicType)) {
            return false;
        }
        SocioEconomicType other = (SocioEconomicType) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.pacis.shca.domain.entity.SocioEconomicType[ id=" + id + " ]";
    }
    
}
